import request from '@/utils/request'

// 查询通道配置列表
export function listChannel(query) {
  return request({
    url: '/video/channel/list',
    method: 'get',
    params: query
  })
}

// 查询通道配置详细
export function getChannel(channelId) {
  return request({
    url: '/video/channel/' + channelId,
    method: 'get'
  })
}

// 新增通道配置
export function addChannel(data) {
  return request({
    url: '/video/channel',
    method: 'post',
    data: data
  })
}

// 修改通道配置
export function updateChannel(data) {
  return request({
    url: '/video/channel',
    method: 'put',
    data: data
  })
}

// 删除通道配置
export function delChannel(channelId) {
  return request({
    url: '/video/channel/' + channelId,
    method: 'delete'
  })
}

// 获取通道关联的分类列表
export function getChannelCategories(channelId) {
  return request({
    url: '/video/channel/categories/' + channelId,
    method: 'get'
  })
}

// 绑定通道与分类关系
export function bindCategories(channelId, categoryIds) {
  return request({
    url: '/video/channel/bind/' + channelId,
    method: 'post',
    data: categoryIds
  })
}

